//连接mongodb数据库
const mongoose = require("mongoose");
async function main() {
  return await mongoose.connect("mongodb://localhost:27017/express-lego");
}
main()
  .then(() => {
    console.log("数据库连接成功");
  })
  .catch((err) => {
    console.log("数据库连接失败", err);
  });

module.exports = {
  userModel: mongoose.model("user", require("./userModel")),
  workModel: mongoose.model("work", require("./workModel")),
};
